<template>
  <div>
    <el-tag :type="state.type">{{
      state.statusDict[renderField.prop as any][renderRow.summary]
    }}</el-tag>
  </div>
</template>
<script lang="ts" setup>
import { onMounted, reactive, inject } from "vue";
import type { TableColumn, TableRow, OptButton } from "@/utils/baTable"; //表格列行类型

const analysis = inject("analysis") as any;

// BuildAdmin将自动为此组件传递五个Props
interface Props {
  renderValue: any; // 单元格值
  renderRow: TableRow; // 当前行数据
  renderField: TableColumn; // 当前列数据
}

const props = withDefaults(defineProps<Props>(), {});

const state: { statusDict: any; type: string } = reactive({
  statusDict: analysis.tags,
  type:
    analysis.tags[props.renderField.prop as any][props.renderRow.summary] ===
    "冷却能耗"
      ? "success"
      : "",
});

onMounted(() => {
  // console.log("TagVue单元格值", analysis.tags);
});
</script>
<style lang="scss" scoped></style>
